package com.mzy.basics.test.clone;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @author Ives
 * * @date 2022/1/26
 */
@Getter
@Setter
@AllArgsConstructor
public class Person implements Cloneable {
  private Address address;
  // 省略构造函数、Getter&Setter方法
  @Override
  public Person clone() {
    try {
      Person person = (Person) super.clone();
      person.setAddress(person.getAddress().clone());
      return person;
    } catch (CloneNotSupportedException e) {
      throw new AssertionError();
    }
  }
}